package org.notify.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 */
@Entity
@Table(name = "relation")
@NamedQueries({
    @NamedQuery(name = "Relation.findAll", query = "SELECT r FROM Relation r"),
    @NamedQuery(name = "Relation.findByIdNodoPerla", query = "SELECT r FROM Relation r WHERE r.idNodoPerla = :idNodoPerla"),
    @NamedQuery(name = "Relation.findByIdSensoreGis", query = "SELECT r FROM Relation r WHERE r.idSensoreGis = :idSensoreGis"),
    @NamedQuery(name = "Relation.findByLabelSensoreGis", query = "SELECT r FROM Relation r WHERE r.labelSensoreGis = :labelSensoreGis"),
    @NamedQuery(name = "Relation.findByNotifica", query = "SELECT r FROM Relation r WHERE r.notifica = :notifica"),
    @NamedQuery(name = "Relation.findByLastUpdate", query = "SELECT r FROM Relation r WHERE r.lastUpdate = :lastUpdate")})
public class Relation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @Column(name = "idNodoPerla")
    private String idNodoPerla;
    @Id
    @Basic(optional = false)
    @Column(name = "idSensoreGis")
    private Integer idSensoreGis;
    @Basic(optional = false)
    @Column(name = "labelSensoreGis")
    private String labelSensoreGis;
    @Basic(optional = false)
    @Column(name = "notifica")
    private boolean notifica;
    @Basic(optional = false)
    @Column(name = "last_update")
    @Temporal(TemporalType.TIMESTAMP)
    private Date lastUpdate;

    public Relation() {
    }

    public Relation(Integer idSensoreGis) {
        this.idSensoreGis = idSensoreGis;
    }

    public Relation(Integer idSensoreGis, String idNodoPerla, String labelSensoreGis, boolean notifica, Date lastUpdate) {
        this.idSensoreGis = idSensoreGis;
        this.idNodoPerla = idNodoPerla;
        this.labelSensoreGis = labelSensoreGis;
        this.notifica = notifica;
        this.lastUpdate = lastUpdate;
    }

    public String getIdNodoPerla() {
        return idNodoPerla;
    }

    public void setIdNodoPerla(String idNodoPerla) {
        this.idNodoPerla = idNodoPerla;
    }

    public Integer getIdSensoreGis() {
        return idSensoreGis;
    }

    public void setIdSensoreGis(Integer idSensoreGis) {
        this.idSensoreGis = idSensoreGis;
    }

    public String getLabelSensoreGis() {
        return labelSensoreGis;
    }

    public void setLabelSensoreGis(String labelSensoreGis) {
        this.labelSensoreGis = labelSensoreGis;
    }

    public boolean getNotifica() {
        return notifica;
    }

    public void setNotifica(boolean notifica) {
        this.notifica = notifica;
    }

    public Date getLastUpdate() {
        return lastUpdate;
    }

    public void setLastUpdate(Date lastUpdate) {
        this.lastUpdate = lastUpdate;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSensoreGis != null ? idSensoreGis.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Relation)) {
            return false;
        }
        Relation other = (Relation) object;
        if ((this.idSensoreGis == null && other.idSensoreGis != null) || (this.idSensoreGis != null && !this.idSensoreGis.equals(other.idSensoreGis))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.notify.entities.Relation[idSensoreGis=" + idSensoreGis + "]";
    }

}
